let generateError = function (name, code, message) {
  let c = function (customMsg, customCode) {
    let temp = Error.call(this);
    temp.name = this.name = name;
    this.code = customCode || code;
    this.message = customMsg || message;
    this.stack = temp.stack;
  };

  c.prototype = Object.create(Error.prototype, {
    constructor: {
      value: c,
      writable: true,
      configurable: true
    }
  });
  return c;
};

module.exports = {
  TokenValidationFailure: generateError('tokenValidationFailure', 401, 'token校验失败')
};
